﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using 简单了解Graphics操作;

namespace 简单了解Graphics操作
{
    public partial class Form3 : Form
    {
        public Form3()
        {
            InitializeComponent();
        }

        private void Form3_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            Pen pen = new Pen(Color.Blue, 4);

            Rectangle rectangle = new Rectangle(60, 120, 180, 180);
            g.DrawRectangle(pen, rectangle);

            //为指定矩形填充颜色
            g.FillRectangle(new SolidBrush(Color.Yellow), rectangle);
        }
    }
}